package com.ashen.study.aop;

import com.ashen.study.service.AuthService;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author hxl
 * @Classname SecurityAspect
 * @Description 注解方式实现Aop
 * 1.方法级别@annotation
 * 2.类级别 @within
 * 3.类级别 @target
 * 4.类级别 @args
 * @Date 2019/9/6 14:47
 */
@Aspect
@Component
public class SecurityAspect {

    @Resource
    AuthService authService;

//    /**定义注解模式--方法级别**/
//    @Pointcut("@annotation(AdminOnly)")
//    /**类级别匹配**/
//    @Pointcut("@within(NeedSecured) && within(com.ashen.study..*)")
//    /**类级别匹配**/
//    @Pointcut("@target(NeedSecured) && within(com.ashen.study..*)")
//    /**类级别匹配**/
//    @Pointcut("@args(NeedSecured) && within(com.ashen.study..*)")
//    public void adminOnly(){
//
//    }

//    @Before("adminOnly()")
//    public void check(){
//        System.out.println("nice boy aa");
////        authService.checkAccess();
//    }


}
